<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<link rel="icon" href="<c:url value='/images/favicon.ico'/>">
<title>用户登录</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet"
	href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
	
<link rel="stylesheet"
	href="<c:url value='/css/user/login.css'/>">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="<c:url value='/js/user/login.js'/>"></script>
<script type="text/javascript">
	$(function(){
		var loginname = window.encodeURI("${cookie.loginname.value }");
		if("${requestScope.user.loginname}"){
			loginname = "${requestScope.user.loginname}";
		}
		$("#loginname").val(loginname);
	});
</script>
</head>
<body>
	<div class="container" style="width: 400px; margin-top: 100px;">
		<h3 class="page-header">
			<strong>用户登录</strong>
		</h3>
		<form class="form-horizontal" method="post" action="<c:url value='/UserServlet'/>" >
			<input type="hidden" name="method" value="login" >
			<c:choose>
				<c:when test="${empty msg }">
					
				</c:when>
				<c:otherwise>
				<div class="form-group">
					<div class="alert alert-danger" role="alert" id="loginError">
						<span class="glyphicon glyphicon-exclamation-sign"
							aria-hidden="true"></span> <span class="sr-only">Error:</span> <span>${msg }</span>
					</div>
				</div>
				</c:otherwise>
			</c:choose>
			<div class="form-group">
				<label for="loginname" class="sr-only">用户名:</label> <input
					type="text" id="loginname" name="loginname" class="form-control input"
					placeholder="用户名" required >
				<div class="alert alert-danger" role="alert" id="loginnameError">
					<span class="glyphicon glyphicon-exclamation-sign"
						aria-hidden="true"></span> <span class="sr-only">Error:</span> <span>${error.loginname }</span>
				</div>
			</div>

			<div class="form-group">
				<label for="loginpass" class="sr-only">密码:</label> <input
					type="password" id="loginpass" name="loginpass"
					class="form-control input" placeholder="密码" required  value="${user.loginpass }">
				<div class="alert alert-danger" role="alert" id="loginpassError">
					<span class="glyphicon glyphicon-exclamation-sign"
						aria-hidden="true"></span> <span class="sr-only">Error:</span> <span>${error.loginpass }</span>
				</div>
			</div>
			<div class="checkbox form-group">
				<label> <input type="checkbox" value="remember-me">
					记住我
				</label>
			</div>
			<div class="form-group">
				<label for="verifyCode" class="sr-only">验证码:</label> <input
					type="text" id="verifyCode" name="verifyCode" class="form-control input"
					placeholder="验证码" required   value="${user.verifyCode }">
				<div class="alert alert-danger" role="alert" id="verifyCodeError">
					<span class="glyphicon glyphicon-exclamation-sign"
						aria-hidden="true"></span> <span class="sr-only">Error:</span> <span>${error.verifyCode }</span>
				</div>
			</div>
			<div class="form-group form-inline" id="vCodeContainer">
				<img id="vCode" src="<c:url value='/VerifyCodeServlet'/>" alt="验证码" /><a href="javascript: _change()">看不清楚，换一张</a>
			</div>
			<div class="form-group">
				<button class="btn btn-md btn-primary btn-block" type="submit" id="submit">马上登陆</button>
			</div>
			<div class="form-group">
				还没有账号？<a href="<c:url value='regist.jsp'/>">马上注册！</a>
			</div>
		</form>
	</div>
</body>
</html>


<!-- -------------------------------------------------------------------- 
<!DOCTYPE HTML>
<html>
  <head>
    
    <title>登录</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	
	<link rel="stylesheet" type="text/css" href="<c:url value='/jsps/css/user/login.css'/>">
	<script type="text/javascript" src="<c:url value='/jquery/jquery-1.5.1.js'/>"></script>
	<script src="<c:url value='/js/common.js'/>"></script>

  </head>
  
  <body>
	<div class="main">
	  <div><img src="<c:url value='/images/logo.gif'/>" /></div>
	  <div>
	    <div class="imageDiv"><img class="img" src="<c:url value='/images/zj.png'/>"/></div>
        <div class="login1">
	      <div class="login2">
            <div class="loginTopDiv">
              <span class="loginTop">传智会员登录</span>
              <span>
                <a href="<c:url value='/jsps/user/regist.jsp'/>" class="registBtn"></a>
              </span>
            </div>
            <div>
              <form target="_top" action="<c:url value='/index.jsp'/>" method="post" id="loginForm">
                <input type="hidden" name="method" value="" />
                  <table>
                    <tr>
                      <td width="50"></td>
                      <td><label class="error" id="msg">用户名或密码错误</label></td>
                    </tr>
                    <tr>
                      <td width="50">用户名</td>
                      <td><input class="input" type="text" name="loginname" id="loginname"/></td>
                    </tr>
                    <tr>
                      <td height="20">&nbsp;</td>
                      <td><label id="loginnameError" class="error">用户名不能为空</label></td>
                    </tr>
                    <tr>
                      <td>密　码</td>
                      <td><input class="input" type="password" name="loginpass" id="loginpass"/></td>
                    </tr>
                    <tr>
                      <td height="20">&nbsp;</td>
                      <td><label id="loginpassError" class="error">密码不能为空</label></td>
                    </tr>
                    <tr>
                      <td>验证码</td>
                      <td>
                        <input class="input yzm" type="text" name="verifyCode" id="verifyCode" value=""/>
                        <img id="vCode" src=""/>
                        <a id="verifyCode">换张图</a>
                      </td>
                    </tr>
                    <tr>
                      <td height="20px">&nbsp;</td>
                      <td><label id="verifyCodeError" class="error">验证码不能为空！</label></td>
                    </tr>
                    <tr>
                      <td>&nbsp;</td>
                      <td align="left">
                        <input type="image" id="submit" src="<c:url value='/images/login1.jpg'/>" class="loginBtn"/>
                      </td>
                    </tr>																				
                 </table>
              </form>
            </div>
          </div>
        </div>
      </div>
	</div>
  </body>
</html>
	-->